//  ProjectConfigurationPropertyPanel.cs
//
//  This file was derived from a file from #Develop. 
//
//  Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com>
// 
//  This program is free software; you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation; either version 2 of the License, or
//  (at your option) any later version.
// 
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//  GNU General Public License for more details.
//  
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

using System;
using Gtk;

using MonoDevelop.Projects;
using MonoDevelop.Ide.Projects;
using MonoDevelop.Components;
using MonoDevelop.Core;
using MonoDevelop.Ide.Gui.Dialogs;

namespace PhpBinding
{
	public class ProjectConfigurationPropertyPanel : MultiConfigItemOptionsPanel
	{
		CodeGenerationPanelWidget widget;
		
		public override Widget CreatePanelWidget()
		{
			return (widget = new CodeGenerationPanelWidget ());
		}
		
		public override void LoadConfigData ()
		{
			widget.LoadConfigData (this);
		}
		
		public override void ApplyChanges ()
		{
			widget.Store ();
		}
	}

	partial class CodeGenerationPanelWidget : Gtk.Bin 
	{
		DotNetProjectConfiguration configuration;
		DotNetProject project;
		
		public CodeGenerationPanelWidget ()
		{	
			Build ();
			
			ListStore store = new ListStore (typeof (string));
			store.AppendValues (GettextCatalog.GetString ("Executable"));
			store.AppendValues (GettextCatalog.GetString ("Library"));
			compileTargetCombo.Model = store;
			CellRendererText cr = new CellRendererText ();
			compileTargetCombo.PackStart (cr, true);
			compileTargetCombo.AddAttribute (cr, "text", 0);
			
		}
		
		public void LoadConfigData (ProjectConfigurationPropertyPanel dlg)
		{	
			configuration = (DotNetProjectConfiguration) dlg.CurrentConfiguration;
			project = (DotNetProject) dlg.ConfiguredProject;
			

			compileTargetCombo.Active = (int) configuration.CompileTarget;

			generateDebugInformationCheckButton.Active = configuration.DebugMode;
			warningsAsErrorsCheckButton.Active = !configuration.RunWithWarnings;
			
		}
		
		public bool Store ()
		{
			return true;
		}
	}

}
